load("@fbcode_macros//build_defs/lib:rust_oss.bzl", "rust_oss")
load("@fbsource//tools/build_defs:rust_library.bzl", "rust_library")

oncall("scm_server_infra")

rust_library(
    name = "cas_client",
    srcs = glob(["client/**/*.rs"]),
    autocargo = {"cargo_toml_dir": "client"},
    deps = ([
        "fbsource//third-party/rust:async-trait",
        "fbsource//third-party/rust:bytes",
        "fbsource//third-party/rust:futures",
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:thiserror",
        "//eden/mononoke/server/context:context",
        "//eden/mononoke/mononoke_types:mononoke_types",
        "//eden/mononoke/blobstore:blobstore",
        "//eden/mononoke/blobstore:fileblob",
        "//common/rust/shed/fbinit:fbinit",
    ] + ([] if rust_oss.is_oss_build() else [
        "//remote_execution/cas/client_lib/wrappers/rust:cas_client_lib",
        "//common/rust/shed/futures_ext:futures_ext",
        "fbsource//third-party/rust:tracing",
        "fbsource//third-party/rust:tokio",
    ])),
)

rust_library(
    name = "scm_client",
    srcs = glob(["scm_client/**/*.rs"]),
    autocargo = {"cargo_toml_dir": "scm_client"},
    deps = [
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:bytes",
        "fbsource//third-party/rust:futures",
        "fbsource//third-party/rust:thiserror",
        "//common/rust/shed/stats:stats",
        "//eden/mononoke/blobstore:blobstore",
        "//eden/mononoke/cas_client:cas_client",
        "//eden/mononoke/mercurial:mercurial_types",
        "//eden/mononoke/mononoke_types:mononoke_types",
        "//eden/mononoke/repo_attributes/filestore:filestore",
        "//eden/mononoke/server/context:context",
    ],
)

rust_library(
    name = "changesets_uploader",
    srcs = glob(["changesets_uploader/**/*.rs"]),
    autocargo = {"cargo_toml_dir": "changesets_uploader"},
    deps = [
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:atomic-counter",
        "fbsource//third-party/rust:bytesize",
        "fbsource//third-party/rust:futures",
        "fbsource//third-party/rust:thiserror",
        "fbsource//third-party/rust:tracing",
        "//common/rust/shed/bounded_traversal:bounded_traversal",
        "//common/rust/shed/cloned:cloned",
        "//common/rust/shed/stats:stats",
        "//eden/mononoke/blobstore:blobstore",
        "//eden/mononoke/cas_client:cas_client",
        "//eden/mononoke/cas_client:scm_client",
        "//eden/mononoke/common/futures_watchdog:futures_watchdog",
        "//eden/mononoke/manifest:manifest",
        "//eden/mononoke/mercurial:mercurial_types",
        "//eden/mononoke/mononoke_types:mononoke_types",
        "//eden/mononoke/repo_attributes/bonsai_hg_mapping:bonsai_hg_mapping",
        "//eden/mononoke/repo_attributes/repo_blobstore:repo_blobstore",
        "//eden/mononoke/server/context:context",
    ],
)
